/*
        Updater For Java Programs 
        
    Copyright (C) 2010, Arttu Viljakainen 
    Published under GNU General Public License V3 
    (see http://www.gnu.org/licenses/licenses.html)
    
    This file is part of Updater For Java Programs.

    Updater For Java Programs is free software: 
    you can redistribute it and/or modify it under the terms of the GNU General 
    Public License as published by the Free Software Foundation, 
    either version 3 of the License, or (at your option) any later version.

    Updater For Java Programs is distributed in the hope that it will be useful, 
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 
    Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Updater for Java Programs. If not, see         
    <http://www.gnu.org/licenses/>.
 */
package updater.listener;


import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import updater.control.UpdateController;


public class UpdateListener implements ActionListener {

    private UpdateController controller;
    
    public UpdateListener(UpdateController controller) {
        this.controller = controller;
    }
    
    @Override
    public void actionPerformed(ActionEvent event) {
        if(event.getActionCommand().equals("Start update")) {
            controller.startUpdate();
        } else if(event.getActionCommand().equals("Cancel")) {
            controller.cancelUpdate();
        } else if(event.getActionCommand().equals("Finished")) {
            controller.finishUpdate();
        } else if(event.getActionCommand().equals("Exit")) {
            controller.exitWithoutUpdating();
        }
    }

}
